const express = require('express');
const { createProxyMiddleware } = require('http-proxy-middleware');

const app = express();
const PORT = 8000;
const proxy = createProxyMiddleware({
  changeOrigin: true,
  router: (req) => {
    return req.get('x-target');
  },
  pathRewrite: (path, req) => {
    return path;
  }
});
app.use('/', proxy);
app.listen(PORT, () => {
  console.log(`Server is running on http://localhost:${PORT}`);
});
